<?php 
require("gConfig.php");
$uid = $_GET['uid'];
$n = $_GET["N"];
if ( $uid == "" )
{
    exit( );
}
if(!isset($n)){
	exit();
}
checkuid($uid,5);

$query = "select oSno,oPB from b_out where oSno>=(select min(oSno) from (select  * from b_out order by oDate desc limit {$n}) as t)";
$result = mysql_query($query,$comm);
$line = 0;
echo "{";
while ( $row = mysql_fetch_row( $result ) ){
	if($line != 0) echo ",";
	echo "\"$line\":{";
	echo "
	\"oSno\":\"$row[0]\",
	\"oPB\":\"$row[1]\"
	";
	echo "}";
	$line += 1;
}
echo "}";
?>